
package com.bang.daybreak.common.mybatisplus.generate;

import com.baomidou.mybatisplus.generator.AutoGenerator;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 * Mysql代码生成器
 * </p>
 *
 * @author wdj
 */
@Slf4j
public class MysqlGenerator extends SuperGenerator {

    /**
     * 代码生成
     *
     * @param tableName 传入表名，
     *                  如果导出全部表结构。tableName传null.
     *                  单个表导出传入表名称.
     */
    public void generator(String tableName) {
        // 代码生成器
        AutoGenerator mpg = getAutoGenerator(tableName);
        mpg.execute();
        if (tableName == null) {
           log.info(" Generator Success !");
        } else {
            log.info(" TableName【 " + tableName + " 】" + "Generator Success !");
        }
    }

    public  static void main(String [] args) {
        MysqlGenerator mysqlGenerator = new MysqlGenerator();
        mysqlGenerator.generator(null);
    }


}
